﻿using WpfApplication1;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;

namespace Admin_tests
{
    
    
    /// <summary>
    ///This is a test class for assignmentTest and is intended
    ///to contain all assignmentTest Unit Tests
    ///</summary>
    [TestClass()]
    public class assignmentTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion
        
        /// <summary>
        ///A test for RemoveAnswer
        ///</summary>
        [TestMethod()]
        public void RemoveAnswerTest()
        {
            Assignment target = new Assignment();
            target.AddAnswer("Mark");
            target.AddAnswer("Michael");
            string answer = "Mark";
            string expected = "Michael";
            target.RemoveAnswer(answer);
            Assert.AreEqual(target.GetAnswerlist()[0].Realanswer, expected);
        }

        /// <summary>
        ///A test for GetType
        ///</summary>
        [TestMethod()]
        public void GetTypeTest()
        {
            Assignment target = new Assignment(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.GetType();
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for GetAnswerlist
        ///</summary>
        [TestMethod()]
        public void GetAnswerlistTest()
        {
            Assignment target = new Assignment(); // TODO: Initialize to an appropriate value
            target.AddAnswer("Mark");
            List<Answer> expected = new List<Answer>(); // TODO: Initialize to an appropriate value
            Answer expectedAnswer = new Answer("Mark");
            expected.Add(expectedAnswer);
            List<Answer> actual;
            actual = target.GetAnswerlist();
            Assert.AreEqual(expected.Count, actual.Count);
            for (int i = 0; i < actual.Count; i++)
            {
                Assert.IsInstanceOfType(actual[i], expected[i].GetType());
            }
        }

        /// <summary>
        ///A test for AddBasicInformation
        ///</summary>
        [TestMethod()]
        public void AddBasicInformationTest()
        {
            Assignment target = new Assignment(); // TODO: Initialize to an appropriate value
            string aname = string.Empty; // TODO: Initialize to an appropriate value
            string aassignmentText = string.Empty; // TODO: Initialize to an appropriate value
            int atype = 0; // TODO: Initialize to an appropriate value
            target.AddBasicInformation(aname, aassignmentText, atype);
            Assert.AreEqual(target.AssignmentText, aassignmentText);
            Assert.AreEqual(target.Name, aname);
            Assert.AreEqual(target.GetType(), atype);
        }

        /// <summary>
        ///A test for AddAnswer
        ///</summary>
        [TestMethod()]
        public void AddAnswerTest()
        {
            Assignment target = new Assignment(); // TODO: Initialize to an appropriate value
            Answer answer = new Answer("Mark"); // TODO: Initialize to an appropriate value
            target.AddAnswer(answer.Realanswer);
            Answer expected = answer;
            Assert.IsInstanceOfType(target.GetAnswerlist()[target.GetAnswerlist().Count - 1], expected.GetType());
        }
    }
}
